package model;

import init.DBManagement;

import java.util.Vector;

import model.beans.MaestroBean;

public class Teacher {
	public static Vector list(String str_subjectCode){
		Vector vec_retVal = new Vector();
		String str_list = 
			" SELECT PRO.CLAVE, "+
			"	     PRO.NOMBRE "+
			" FROM	 BASMATB MAT, "+
			"	     BASMPRR MPR, "+
			"	     BASPROB PRO "+			 
			" WHERE  MAT.CLAVE = '"+str_subjectCode+"' AND "+
			"        MAT.CLAVE = MPR.MATERIA_TK AND "+
			"        PRO.CLAVE = MPR.PROFESOR_TK";
		DBManagement database = new DBManagement();
	    database.executeQuery( str_list );
	    for( int int_i = 0; int_i < database.getNumRows(); int_i++){
	    	MaestroBean teacher = new MaestroBean();
	    	teacher.setCodigo(database.getItem(int_i, 0));
	    	teacher.setNombre(database.getItem(int_i, 1));
	    	vec_retVal.add(teacher);
	    }
		return vec_retVal;
	}
}
